package com.zhuss.controller.core;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.core.company.DetailCompanyBo;
import com.zhuss.bean.bo.core.company.DetailDeptBo;
import com.zhuss.bean.bo.core.company.ListCompanyByTypeBo;
import com.zhuss.bean.bo.core.company.ListDeptByCompanyBo;
import com.zhuss.bean.bo.core.company.SearchCompanyBo;
import com.zhuss.bean.bo.core.company.SearchDeptBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.ReadService;
import com.zhuss.core.company.CompanyReadServiceExt;
import com.zhuss.exception.AabException;


/**
 * 公司查询 controller
 * @Author zhushanshuo
   @Date 2020-02-04 22:58
 *
 */
  
 
@RestController
@RequestMapping("/company")
public class CompanyReadController extends BaseController {
	
	@Autowired
	@Qualifier("companyReadService")
	private ReadService<Object, Object> companyReadService;
	
	@Autowired
	@Qualifier("companyReadServiceExt")
	private CompanyReadServiceExt companyReadServiceExt;
	
	/**
	 * 详情
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/detail")
    public Object detail(@RequestBody DetailCompanyBo bo) throws AabException {
		
		Object result = companyReadService.detail(bo);
		return result;
    }
	
	/**
	 * 列表
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
    @RequestMapping("/list")
    public Object list(@RequestBody SearchCompanyBo bo) throws AabException {
		
		Object result = companyReadService.list(bo);
		return result;
    }
	
	/**
	 * 根据类型查询公司列表
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
    @RequestMapping("/listByType")
    public Object listByType(@RequestBody ListCompanyByTypeBo bo) throws AabException {
		
		Object result = companyReadServiceExt.listByType(bo);
		return result;
    }
	
	/**
	 * 根据类型查询公司列表
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
    @RequestMapping("/listDeptByCompany")
    public Object listDeptByCompany(@RequestBody ListDeptByCompanyBo bo) throws AabException {
		
		Object result = companyReadServiceExt.listDeptByCompany(bo);
		return result;
    }
	
	/**
	 * 部门列表
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
    @RequestMapping("/deptList")
    public Object deptList(@RequestBody SearchDeptBo bo) throws AabException {
		
		Object result = companyReadServiceExt.deptList(bo);
		return result;
    }
	
	/**
	 * 部门详情
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
    @RequestMapping("/deptDetail")
    public Object deptDetail(@RequestBody DetailDeptBo bo) throws AabException {
		
		Object result = companyReadServiceExt.deptDetail(bo);
		return result;
    }
	

	
}
